import xml.dom.minidom

import urllib2


def fetch_docs(url):
  docs = []

  while url:
    txt = urllib2.urlopen(url).read()
    doc = xml.dom.minidom.parseString(txt)
    docs.append(doc)

    url = None
    for link in doc.getElementsByTagName('link'):
      if link.hasAttribute('rel'):
        rel = link.getAttribute('rel')
        if rel == 'next':
          url = link.getAttribute('href')
          break

  return docs
